/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : levelLogic
	/// </summary>
	public class LevelBuffPOD : IPOD 
    {
        public readonly static Func<LevelBuffPOD> FACTORY = () => new LevelBuffPOD();
		public static Func<LevelBuffPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public int cid;
		/// <summary>
        /// 
        /// </summary>
		public int stack;
		/// <summary>
        /// 
        /// </summary>
		public float leftSec;
		
		
		
		/*-- constructors --*/
		public LevelBuffPOD() {}
		public LevelBuffPOD(int cid, int stack, float leftSec) {
			this.cid = cid;
			this.stack = stack;
			this.leftSec = leftSec;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(cid);
            _out.Write_int(stack);
            _out.Write_float(leftSec);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            cid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            stack = _in.Read_int();
            if(!_in.HasRemaining()) return;
            leftSec = _in.Read_float();
        }
		
		public LevelBuffPOD Clone() {
            LevelBuffPOD o = DynamicFactory();
            o.cid = cid;
            o.stack = stack;
            o.leftSec = leftSec;
            return o;
        }
        
        public void Clear() {
            cid = default;
            stack = default;
            leftSec = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "LevelBuffPOD [";
			str += "cid=";
			str += cid;
			str += ", stack=";
			str += stack;
			str += ", leftSec=";
			str += leftSec;
			str += "]";
			return str;
		}
		
	}
}